<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="org.apache.catalina.Session"%>
<%@ page import="java.sql.Date,java.sql.*"%>
<%@ page import="cn.ticket.db.DBConnect"%>
<%@ page import="cn.ticket.util.StringUtil"%>
<%@ page import="cn.ticket.Constant"%>
    <%
    request.setCharacterEncoding("utf8" ) ;
    String busId= request.getParameter("id") ;
    int price= Integer.parseInt(request.getParameter("price")) ;
    int total= Integer.parseInt(request.getParameter("total")) ;
    String num = request.getParameter("num") ;
    String time=request.getParameter("time") ;
	String userId= (String)session.getAttribute("login_user_id") ;
	String oriStation1 = request.getParameter("oriStation1" ) ;
	String oriStation2 = request.getParameter("oriStation2" ) ;
	String oriStation = oriStation1+"-"+oriStation2 ;
	String desStation1 = request.getParameter("desStation1" ) ;
	String desStation2 = request.getParameter("desStation2" ) ;
	String desStation = desStation1+"-"+desStation2 ;
	
if(null==num || "".equals(num)){
	session.setAttribute("errorinfo", "车次编号"+Constant.ERRORINFO_PARAMETERNULL) ;
	%>
	<jsp:forward page="/front/result.jsp" />
	<%
}		
	Connection con = new DBConnect().DBConnection() ;
	try {
		String sql="update  bus set num='"+num+"' , price="+price+" , time='"+time+"' ,total="+total
				+" ,oriStation='"+oriStation+"' ,desStation='"+desStation+"' ,remain="+total+" where id='"+busId+"' " ;
		System.out.println(sql) ;
		PreparedStatement pstmt =  con.prepareStatement(sql) ;
		pstmt.execute(sql) ;
	 %>
		<jsp:forward page="busList.jsp" />
		<%
	}catch(Exception e){
		session.setAttribute("errorinfo", Constant.ERRORINFO_NETERROR+e) ;		
		%>
		<jsp:forward page="/front/result.jsp" />
		<%
	}
	
%>
